UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jp+nUGImvVH4gLvHaIJXcm6hfGSYwNHWDM7Ga/gerHs=' 
WHERE 
  key_id = '867b2a1bad186c2b15aeafde8cd035a6cc989a7445ad5e8e04815863a6c7a8b6' 
  AND (
    token = 'Jp+nUGImvVH4gLvHaIJXcm6hfGSYwNHWDM7Ga/gerHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026