UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zOUbA3FYxOHKVStw3Lm5PD4jbZ7x8MVfS6aPem8Bps8='
WHERE
key_id = '33495b3fe994db1445a9158f571699431edff79f815f10ae39e8c503309062f5'
AND (
token = 'zOUbA3FYxOHKVStw3Lm5PD4jbZ7x8MVfS6aPem8Bps8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)