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