UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+FssJaiNn56um2WExWbRnlni93/tcP7hkd0hUG9lsc=' 
WHERE 
  key_id = '9fda763ceb7e69c66cc654ec6f51e55a4315a56af0723dba9169e4b0e8e8e388' 
  AND (
    token = 'Y+FssJaiNn56um2WExWbRnlni93/tcP7hkd0hUG9lsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045