UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b3dd+soJOf3a19TwraVAcOHSeXJCm658VwrXYh79rfM=' 
WHERE 
  key_id = '8059a588c3bbbfdf528457fdc5f8c30777e3754e7ca60652b01029af902cb419' 
  AND (
    token = 'b3dd+soJOf3a19TwraVAcOHSeXJCm658VwrXYh79rfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026