UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RS/gDWldHyr9LmpLly6wt9vawXEtvs4vseD6KfenZlo=' 
WHERE 
  key_id = '6415e734cb53165408eb738265b8907b407fd3e27384963a6ec780ea5ab05fcc' 
  AND (
    token = 'RS/gDWldHyr9LmpLly6wt9vawXEtvs4vseD6KfenZlo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026