UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qtrDp/zRl+Da+chT2cj/WGLD7KeR5RVofIWoCopmgKg=' 
WHERE 
  key_id = '17117f2f7ebb725d88f5681764c99712c1f03907b51804b2c71308c0b42f9927' 
  AND (
    token = 'qtrDp/zRl+Da+chT2cj/WGLD7KeR5RVofIWoCopmgKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032