UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'besLM+eiyTJIBi6/itzxNsTHxSM0Yuyf12Ikm1mCB1s=' 
WHERE 
  key_id = '37847cb2589653086c0ad81f98c6c96f893a01b05a742093ab7d844387860dea' 
  AND (
    token = 'besLM+eiyTJIBi6/itzxNsTHxSM0Yuyf12Ikm1mCB1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047