UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F45wucQhu5ui5NjCjd2oAxGUy0Z17vlmCPEFUu3fMf0=' 
WHERE 
  key_id = '00a5b76637cc9c7fa83d316e2656807997341ed382af221e20d3c2faef0e2038' 
  AND (
    token = 'F45wucQhu5ui5NjCjd2oAxGUy0Z17vlmCPEFUu3fMf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030