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