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