UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GPallJl/COz2LfZW0koLq/VbehcKR7vymPw/0t6Rv2A=' 
WHERE 
  key_id = '66c78ee5ae00155393b796d87a0eaf974fc7bfaf0aa40b30dc41eeae36fc3800' 
  AND (
    token = 'GPallJl/COz2LfZW0koLq/VbehcKR7vymPw/0t6Rv2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033