UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4QDYQ4e9bfdwKezioEDocE0PLdHsaT3QH1NCw4hu2vk='
WHERE
key_id = '9434c5414dc8b10200130fba77cd880068a4c7290ec043540e9792dd355f3675'
AND (
token = '4QDYQ4e9bfdwKezioEDocE0PLdHsaT3QH1NCw4hu2vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)