UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CLyyMs2B7SdnvL0bAQSxkYQTNjCjJIE3IANS6ibYsdw=' 
WHERE 
  key_id = 'fc0d534975a18feb44d93e82396e938d80d7b4bc4c1c4a675982550144b2262a' 
  AND (
    token = 'CLyyMs2B7SdnvL0bAQSxkYQTNjCjJIE3IANS6ibYsdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028