UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LAcD1SbQMqwD5jfwoROcDtHFwvAViqQ3FEz2rt8D654='
WHERE
key_id = '7f51159bdad586055bc7b44487183faa7c70d142c39e52225953ea4b185c1796'
AND (
token = 'LAcD1SbQMqwD5jfwoROcDtHFwvAViqQ3FEz2rt8D654='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)