UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TT6sf8CClcypzmy5jLY2BjGIt5lEuaUVlaAOcp5Ri0Y=' 
WHERE 
  key_id = 'a81a078e2743003f07589e1f7c9d9c831fd8bd660c9961fc0f8b31ade6dd31f9' 
  AND (
    token = 'TT6sf8CClcypzmy5jLY2BjGIt5lEuaUVlaAOcp5Ri0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025