UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gqK5FXgMUZJmgvxcNshQn1ueKo+ti6higBlSfPSfvz4=' 
WHERE 
  key_id = 'c08821306f3df2bfa40efd4f310da9408e1b03bda01723789efbd40a2cafc004' 
  AND (
    token = 'gqK5FXgMUZJmgvxcNshQn1ueKo+ti6higBlSfPSfvz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037