UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USxAyx3hxVorc/VPVlCIRkFkvts+w4a+OPYH59cJVnI=' 
WHERE 
  key_id = '59fcec9abc1b30da659595382d714992eee910741d83dacf5cb56456c165e6a8' 
  AND (
    token = 'USxAyx3hxVorc/VPVlCIRkFkvts+w4a+OPYH59cJVnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028