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

Query time 0.00019