UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OjpvbAF6tdiAk9SgO7asZLZ5yK7AZNHhB5DAMcx5XAM='
WHERE
key_id = 'fd8e2f9a16b4ea5537cf047b066a26037d32522c89e8b94d79b97258296c08a8'
AND (
token = 'OjpvbAF6tdiAk9SgO7asZLZ5yK7AZNHhB5DAMcx5XAM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)