UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JYBKfXckw7vET/xKyStqQnYVcasuph0eflTrJMOFKRo='
WHERE
key_id = 'd3de196563f44b373baba3445d0779fee0a8ca5b45529e3d9894a2238c31838f'
AND (
token = 'JYBKfXckw7vET/xKyStqQnYVcasuph0eflTrJMOFKRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)