UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OpBWjdtiMfFUcdYD09bLJq2K4ipU8H2np3zKaWdfroY=' 
WHERE 
  key_id = '13572fae3963d7d7f99153997f9486ec23697c4f7d55324396ca537f6aa87953' 
  AND (
    token = 'OpBWjdtiMfFUcdYD09bLJq2K4ipU8H2np3zKaWdfroY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038