UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CGlgtn49DQq3pd/nEO/ReazbB1Uev20GVJxVAYWUNIU=' 
WHERE 
  key_id = '334706b8f1cfe1bd534e7d3b086b09209af87007abf02bc1cbe29cc106adb8c0' 
  AND (
    token = 'CGlgtn49DQq3pd/nEO/ReazbB1Uev20GVJxVAYWUNIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022