UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0fAx66mATL8XKoef0mt74iqXAcNOQIgiTUKplCetv1s='
WHERE
key_id = 'fa0f5d125690423bf5dd13b7245ea6ed7dcd17639a713855a03a3773c2569455'
AND (
token = '0fAx66mATL8XKoef0mt74iqXAcNOQIgiTUKplCetv1s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)