UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2DxEr+YF6EvyHCpM3LtfqbN4BMX/S7t3qT2ZBCT+F+A=' 
WHERE 
  key_id = '01b77b8ae1d20e57f1c096e213b3e4254511cdef57835f3423060f80084b062e' 
  AND (
    token = '2DxEr+YF6EvyHCpM3LtfqbN4BMX/S7t3qT2ZBCT+F+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032