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

Query time 0.00030