UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zjKBkSSB0OYfiw62EMGuBgEukNGkmG7GjEnDe5OVpK8='
WHERE
key_id = '49034895b242c2cfd828e5b568378c25e9a4e3f206b9752c8030e3c6a2506557'
AND (
token = 'zjKBkSSB0OYfiw62EMGuBgEukNGkmG7GjEnDe5OVpK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)