UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hEhvCS3IWPcrIq9KIZkmwjBMgAv/cDgr4rsz4wABj4o='
WHERE
key_id = '87014c93d603d883382f471ff48a3e52a1d915213613903e415ffbc4714923f6'
AND (
token = 'hEhvCS3IWPcrIq9KIZkmwjBMgAv/cDgr4rsz4wABj4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)