UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5gq4pvoV2XTSXTHQCALhU1PXoYObWO+KOmD72QksLY=' 
WHERE 
  key_id = '2dcfe6e95379c6350b58fbd32b6fd78efaf31a9c4ec797374cadcde8779b1593' 
  AND (
    token = 'P5gq4pvoV2XTSXTHQCALhU1PXoYObWO+KOmD72QksLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023