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