UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sFwqWcXtJR8B6qVvHhOMQUBPmKKWqAKx35p6Z0ycSEs=' 
WHERE 
  key_id = '84ab934bdad16f5d308450e5224359a77c466a8a40d2e5a0b2abb6a800d87d8d' 
  AND (
    token = 'sFwqWcXtJR8B6qVvHhOMQUBPmKKWqAKx35p6Z0ycSEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053