UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5s0aEg+1nI2ybUZfxIZXf4H4pPf9ffVMDq3VvRewZE=' 
WHERE 
  key_id = '440affa763defbe720bfb061a3d6bee138a41c993fc74cbbc990b4b224a3bab3' 
  AND (
    token = 'D5s0aEg+1nI2ybUZfxIZXf4H4pPf9ffVMDq3VvRewZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046