UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q8+bf4Oc7K9V6iai3yUzqiOZZrqVpNYqR6dsWGrxKDk=' 
WHERE 
  key_id = '589c6cf74219e11ad84c0d5eb7a617fe4756233ee2feff58f6eb17559855bee7' 
  AND (
    token = 'q8+bf4Oc7K9V6iai3yUzqiOZZrqVpNYqR6dsWGrxKDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024