UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dnnAOj0L+WJPPUnsaOwOHfxo0O7TrKZdKTXm8ci4jXk=' 
WHERE 
  key_id = '3f8d725705a96da4b438a7f4a279d47f1ce1accaa950774389659af332ff046a' 
  AND (
    token = 'dnnAOj0L+WJPPUnsaOwOHfxo0O7TrKZdKTXm8ci4jXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033