UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0QaHu9zF/ypB039Xt36JA1bgJ5CSKJ2xb+ph3mUNcI=' 
WHERE 
  key_id = 'f023a7648df77bc00a1dbaa1eaeb59c0675d438c32b3a6401573642383c7c21d' 
  AND (
    token = 'O0QaHu9zF/ypB039Xt36JA1bgJ5CSKJ2xb+ph3mUNcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035