UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g7IyO35vf+9hrd5zVUfstNqKZvOcW2iqFS0bBUwMQbg=' 
WHERE 
  key_id = '6f0d22d8cae72d8decc8ca0e98ff7b7ddd4eb6a8eb40a9b190837b26ac831233' 
  AND (
    token = 'g7IyO35vf+9hrd5zVUfstNqKZvOcW2iqFS0bBUwMQbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040