UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R4jgu5EgPyBi3GNfPbZ7PUXB56YGwPqdvU1C6jJcx0o='
WHERE
key_id = '1e5b9416a3cc9a6e8736ca0b19838a6ed7563ade0c84c17784cc42b21de250f1'
AND (
token = 'R4jgu5EgPyBi3GNfPbZ7PUXB56YGwPqdvU1C6jJcx0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)