UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NnSbq+tuSFsgIPNHf69GERyWeBmu0as8uSfxU9wMTEA='
WHERE
key_id = 'f081900215adcb4b176f378b7baac74d38ca62d2a3f5cf9c3f70ee5980685046'
AND (
token = 'NnSbq+tuSFsgIPNHf69GERyWeBmu0as8uSfxU9wMTEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)