UPDATE 
  lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 300, 
  token = '5CIbZqi+W3YKA50tGZlx/EqNB5dRMR6U5+dknPv+9CE=' 
WHERE 
  key_id = 'cdca3954eec4a76b8d8025c405ce6d4bba43a1598dd117993ad9242a253775e5' 
  AND (
    token = '5CIbZqi+W3YKA50tGZlx/EqNB5dRMR6U5+dknPv+9CE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00371