UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pXt/U+fF+K+pfUUAllXX+mArEpKRsXSqVAokC+TfEwE='
WHERE
key_id = '41b0ffbdf63694ce15db706c545a5bba08e63647ee2301771c71509b167fc53e'
AND (
token = 'pXt/U+fF+K+pfUUAllXX+mArEpKRsXSqVAokC+TfEwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)