UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVQ9h66GObSIq0OsukXJGSZF1i1gPA31A7h4WxSQarg=' 
WHERE 
  key_id = '8d06240399b530421fa57f691b7fd4515eab66276609fdc029c77b16dbc15907' 
  AND (
    token = 'vVQ9h66GObSIq0OsukXJGSZF1i1gPA31A7h4WxSQarg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048