UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fGtSQCk6G2L4TN9iuPqj6sVpbwac1IsJd54JAxEgneI=' 
WHERE 
  key_id = '81ed1dd3151e862edbf96d4b7e604916237d63c7194f10424e4033e5bf532449' 
  AND (
    token = 'fGtSQCk6G2L4TN9iuPqj6sVpbwac1IsJd54JAxEgneI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035