UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DY6faGxTOau9vR4/8mq+jKyU2Z8YwAh0BqBcz63uzio='
WHERE
key_id = 'd8cc649745469d771a2dc52dc2de7348b6376c557701c844040c9040916f7327'
AND (
token = 'DY6faGxTOau9vR4/8mq+jKyU2Z8YwAh0BqBcz63uzio='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)