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