UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1aN0LHmGUdzUyoa/W+1iJ0raYb+0Bhri7s+DiVimxuk=' 
WHERE 
  key_id = 'fcefc30d00625586cc9ef4b534499ee80c368297fa02e62cf12762643d2f9a01' 
  AND (
    token = '1aN0LHmGUdzUyoa/W+1iJ0raYb+0Bhri7s+DiVimxuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018