UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mDIq5OaJmq4v2T0WL5qREyKcpD9JNojQg+/SezRZSk4='
WHERE
key_id = 'dfe925b09ec8a8af55a5fbb40f8455b6059cd642299dccb49ca2cf86777b2fd8'
AND (
token = 'mDIq5OaJmq4v2T0WL5qREyKcpD9JNojQg+/SezRZSk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)