UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DWS3ESfiKuhp2SQR8VCnBQvaPPsmykGCTTprAWQ3Tro=' 
WHERE 
  key_id = '31195a1519893124cdd7fb74dd9a4d790bfcfbe8bcd24cf1b16eb3b24ce482d8' 
  AND (
    token = 'DWS3ESfiKuhp2SQR8VCnBQvaPPsmykGCTTprAWQ3Tro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031