UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zcyNRosfw/qECUNLu87hSrH+3TfvuaeavBLMdBV1O24=' 
WHERE 
  key_id = 'a84194b9dfdd2285a0b60506e923d4c823a9b67227719e2f20ad7da44dca6595' 
  AND (
    token = 'zcyNRosfw/qECUNLu87hSrH+3TfvuaeavBLMdBV1O24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032