UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iUnA6KzhdSDdGhqu6R7a5sbcKXg0Qup4IVA/oa/qCnI='
WHERE
key_id = 'a52e83efd809cec3787204d6533fbd33b7586b773cb718351b69c54c1237ca2b'
AND (
token = 'iUnA6KzhdSDdGhqu6R7a5sbcKXg0Qup4IVA/oa/qCnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)