UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyiu/IGewqIlAixwY+CUKgCVFNRnT2A4MJhCsv9+mbw=' 
WHERE 
  key_id = '1bed20b8b4b1a693e09c888ab6b7f292b518fd8f49d3ce3a587bfd9f9f491398' 
  AND (
    token = 'qyiu/IGewqIlAixwY+CUKgCVFNRnT2A4MJhCsv9+mbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025