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