UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BcPsOkROOVQ0PrhNQJjszs0bY2cklZD9tsVNYXINBYQ=' 
WHERE 
  key_id = '9a31ca04a13c5a2537d53101a48f55bebf8f19d9434cb476fe6be8bf7b45e007' 
  AND (
    token = 'BcPsOkROOVQ0PrhNQJjszs0bY2cklZD9tsVNYXINBYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026