UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AVqfUhzLHQnUq14C1Uo0B8wBFX5f2E5kIUq36Vx3oeI=' 
WHERE 
  key_id = '7a923723b59ba8763d484801128a9f5187a37dd550d516f51a71dbee3c288183' 
  AND (
    token = 'AVqfUhzLHQnUq14C1Uo0B8wBFX5f2E5kIUq36Vx3oeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046