UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5AtM0uDQQXNPacodDk9db7diI3VK7KAxM1DskVUZH48='
WHERE
key_id = 'aa1af8cda57c8df9f0ab76d93c9bb324f109e8015cdeff2111e7c63a6625ed4b'
AND (
token = '5AtM0uDQQXNPacodDk9db7diI3VK7KAxM1DskVUZH48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)