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