UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JnHYZ3gqY7u3tutX5g2t6EzGs3uS8cu4uGR9NIs5t9A='
WHERE
key_id = '712416f7203eb8a8a7a4e197c035b6f3d280c8e7db55a57253e66482d2d1ca93'
AND (
token = 'JnHYZ3gqY7u3tutX5g2t6EzGs3uS8cu4uGR9NIs5t9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)