UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zR4YSfHg9BwlHQtfacL6OqCHDdXnTaWrZ1JyCfdXHFo='
WHERE
key_id = '023307dd50f647d26467dbbba733dc7165e52e4f4127623852090637a6aec7a9'
AND (
token = 'zR4YSfHg9BwlHQtfacL6OqCHDdXnTaWrZ1JyCfdXHFo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)