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