UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R3m6wQpQNwq2JQevWdDuno9FpNJyMnFjVbu1deRl1Qc=' 
WHERE 
  key_id = '87e926a30d2985afab58966c2f4e9def6c1ae1e88d79c961d71a8b24d87c7182' 
  AND (
    token = 'R3m6wQpQNwq2JQevWdDuno9FpNJyMnFjVbu1deRl1Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049