UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '14X3Hw6EEBI0OdTdLpcm+3cI10Dtl3B6ZZ+yHyAUkXo='
WHERE
key_id = '746b914cd20a918d8ee590159b35244f8e81321a8b6837dcefb396e225a14cff'
AND (
token = '14X3Hw6EEBI0OdTdLpcm+3cI10Dtl3B6ZZ+yHyAUkXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)