UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GlB7mZGdRq+ttkfrNWkbMgZGkJHZbcQWfVV+sp4iYBs=' 
WHERE 
  key_id = '7585153e262beb4c61e5a287b9c80680698686e7e80001804a06ec8983d25650' 
  AND (
    token = 'GlB7mZGdRq+ttkfrNWkbMgZGkJHZbcQWfVV+sp4iYBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030