UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JrhKtj+9MOyFQvEfb0Ssksm0zyVmJQGOjgCS8mT3Q7Y=' 
WHERE 
  key_id = '8fef9ff6b0d7f06d05be4a9e25706eca01e22e4456ee7411b565c69c9cc0e7c5' 
  AND (
    token = 'JrhKtj+9MOyFQvEfb0Ssksm0zyVmJQGOjgCS8mT3Q7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027